package com.aweqy.hrmanager.controller;

import com.aweqy.hrmanager.entity.Settlement;
import com.aweqy.hrmanager.service.SettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/settlements")
public class SettlementController {
    @Autowired
    private SettlementService settlementService;

    @GetMapping
    public List<Settlement> list() {
        return settlementService.list();
    }

    @PostMapping
    public boolean add(@RequestBody Settlement settlement) {
        return settlementService.save(settlement);
    }

    @PutMapping
    public boolean update(@RequestBody Settlement settlement) {
        return settlementService.updateById(settlement);
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return settlementService.removeById(id);
    }
} 